//{=======================================================================
//! @file A4.c
//! @date 04.10.2013 23:55
//! @author Andrey Drobyshev <immortalguardian1@gmail.com>
//! @ version 1.0
//!
//! @par	Conditions:
//! 		The program reads 3 natural numbers and calculSating
//!		    its largest common multiple.
//}=======================================================================

#include <stdio.h>

//{=================================================================================
//! Function nod - finds the least common divider of two numbers.
//!
//! @param      a   1st number
//! @param      b   The 2nd, as you guess
//!
//! @return     Their least common divider.
//!
//! @note       The function uses Euclid's algorithm.
//}==================================================================================

unsigned int nod ( unsigned int a, unsigned int b);

//{==============================================================
//! Function main - prints welcome messages and the result,
//! controls all the program execution.
//!
//! @return     0 on success
//!
//! @note       The function uses the function "nod".
//}===============================================================

int main ()
{
	unsigned int a = 0, b = 0, c = 0;

	printf ( "#Hey, guy!\n"
             "#I'm the program calculating the least "
             "common multiple of natural 3 numbers.\n"
             "#You're welcome to enter any natural numbers "
             "and I promise to do my best:)\n");

	scanf ( "%u %u %u", &a, &b, &c);
	a = ( b / nod (a, b)) * a;                                           // Here we count the largest common multiple of 2 numbers
	printf ( "#The least common multiple is %u.", ( c / nod (a,c)) * a); // And here count the same for the first two and for the third and display the result
	return 0;
}

unsigned int nod ( unsigned int a, unsigned int b)
{
	while ( a != b)
		if ( a < b)
			b -= a;
		else
			a -= b;
	return a;
}
